# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=tidos-framework
pkgver=v2.0.beta2.r22.g4098187
pkgrel=6
pkgdesc='Offensive Web Application Penetration Testing Framework.'
arch=('any')
groups=('blackarch' 'blackarch-webapp')
url='https://github.com/0xInfection/TIDoS-Framework'
license=('GPL3')
depends=('python' 'ncurses' 'libxml2' 'nmap' 'tcpdump' 'exiv2'
         'python-pip' 'mariadb' 'tor' 'konsole' 'python-argparse'
         'python-texttable' 'sslyze' 'python-tldextract' 'python-lxml'
         'python-pillow' 'python-colorama' 'python-scapy' 'python-pexpect'
         'python-idna' 'python-bs4' 'python-six' 'python-tld' 'python-shodan'
         'python-requests' 'python-google' 'python-emailprotectionslib'
         'python-builtwith' 'python-mechanize' 'python-mysqlclient'
         'python-mysql-connector' 'python-ptyprocess' 'python-dnslib'
         'python-pyqt5' 'photon')
makedepends=('git')
source=("git+https://github.com/0xInfection/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin/"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md

  rm -rf LICENSE *.md '·\»'

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/tidv2" << EOF
#!/bin/sh
cd /usr/share/$pkgname/
exec python tidv2
EOF
  chmod +x "$pkgdir/usr/bin/tidv2"

  cat > "$pkgdir/usr/bin/tidconsole" << EOF
#!/bin/sh
cd /usr/share/$pkgname/
exec python tidconsole.py "\$@"
EOF
  chmod +x "$pkgdir/usr/bin/tidconsole"
}

